<template>
	<view>
		<!-- #ifdef MP-WEIXIN -->
		<myheader :leftType="2"  :noLeft="false" showTitle="联系我们"></myheader>
		<!-- #endif -->
		 <view class="top" :style="{ top: `${statusBarHeight}px` }">
			<view class="top-item" :key="index" v-for="(item, index) in arr" :class="activeIndex == index ? 'top-item_active':''" @tap="itemClick(index)">{{ item }}</view>
			<view class="top-line" :class="activeIndex == 0? 'left12' : 'left62'"></view>
		 </view>
		 <image v-show="activeIndex==0" style="width: 750rpx;height:1750rpx" :src="src_fuwu"></image>
		 <image v-show="activeIndex==1" style="width: 750rpx;height:1980rpx" :src="src_hezuo"></image>
	</view>
</template>

<script>
	import myheader from '../../components/header/index.vue';
	export default {
		components: {
			myheader
		},
		beforeMount() {
			// #ifdef MP-WEIXIN
			let custom = wx.getMenuButtonBoundingClientRect();
			wx.getSystemInfo({
				success: res => {
					this.statusBarHeight = (res.statusBarHeight + (custom.top - res.statusBarHeight)) +
						custom.height + 10
				}
			});
			// #endif
		},
		
		data() {
			return {
				activeIndex: 0,
				arr: [ '大健康企业服务', '商务&市场合作' ],
				statusBarHeight: '',
				src_fuwu: 'https://www.chideqiao.com/api/images/myhm-static/cooperation_1.png',
				src_hezuo: 'https://www.chideqiao.com/api/images/myhm-static/cooperation_2.png'
			}
		},
		methods: {
			itemClick(index) {
				if (this.activeIndex !== index) {
					this.activeIndex = index
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
.top {
	width: 100%;
	height: 94rpx;
	display: flex;
	position: sticky;
	z-index: 10;
	left: 0;
	top:0;
	background: #f4f6f7;
	&-item {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 32rpx;
		color: #2E4964;
		&_active {
			color: #1ABC9C;
			font-weight: bold;
		}
	}
	&-line {
		width: 20rpx;
		height: 8rpx;
		background: #1ABC9C;
		border-radius: 40rpx;
		position: absolute;
		bottom: 4px;
		transition: all .3s;
	}
}
.left12 {
	left: calc(25% - 10rpx)
}
.left62 {
	left: calc(75% - 10rpx)
}
.des {
	display: flex;
	align-items: center;
	justify-content: center;
	width:100%;
	height: 80rpx;
	font-size: 24rpx;
	color: #8292A2;
	border-top: 1px solid #d9dcde;
}
.food {
	width: calc(100% - 40rpx);
	padding: 0 20rpx;
	&-item {
		background: #fff;
		display: flex;
		margin-bottom: 24rpx;
		padding: 20rpx;
		border-radius: 20rpx;
		&-left {
			width: 128rpx;
			height: 128rpx;
		}
		&-mid {
			flex: 1;
			display: flex;
			flex-direction: column;
			margin-left: 10rpx;
			justify-content: space-evenly;
			
			&-top {
				font-size: 32rpx;
				font-weight: bold;
				color:#2E4964;
				max-width: 300rpx;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
			&-bottom {
				display: flex;
				&-item {
					min-width: 116rpx;
					height: 52rpx;
					border-radius: 999px;
					border: 1px solid #EAECEF;
					margin-right: 10rpx;
					color: #8292A2;
					font-size: 28rpx;
					line-height: 52rpx;
					text-align: center;
					padding: 0 4px;
				}
			}
		}
		&-right {
			display: flex;
			&-item {
				flex: 1;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				margin-left: 25rpx;
				&-top {
					width: 48rpx;
					height: 48rpx;
				}
				&-bottom {
					font-size: 24rpx;
					color: #8292A2;
				}
			}			
		} 
	}
} 
.color_active {
	color: #1ABC9C;
}
</style>
